<!-- $Id: card_info.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{include file="pageheader.htm"}
<div class="main-div">
<form method="post" action="cardNum.php" name="theForm" enctype="multipart/form-data" onsubmit="return validate()">
<table cellspacing="1" cellpadding="3" width="100%">
{if $form_action == 'insert'}
  <tr>
    <td class="label">&nbsp;</td>
    <td><input type="radio" name="rg_radio" value="1" onChange="get_cardNum_con(this)" />&nbsp;单条添加&nbsp;&nbsp;&nbsp;<input type="radio" name="rg_radio" value="2"  onChange="get_cardNum_con(this)" checked />&nbsp;批量添加</td>
  </tr>
{/if}
  <tr>
    <td class="label">卡号</td>
    <td><span id="cardNum_con"><input type="text" name="card_name" maxlength="60" size = "30" value="{$cardNum.card_name|escape}" /></span>{$lang.require_field}</td>
  </tr>
  <tr>
    <td class="label"><a href="javascript:showNotice('notice_cardfee');" title="{$lang.form_notice}">
        <img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>卡值</td>
    <td><input type="text" name="card_fee" maxlength="60" size="30" value="{$cardNum.card_fee}" />{$lang.require_field}
    <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="notice_cardfee">使用这个卡号所得到的红包</span>
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
      <input type="submit" class="button" value="{$lang.button_submit}" />
      <input type="reset" class="button" value="{$lang.button_reset}" />
      <input type="hidden" name="act" value="{$form_action}" />
      <input type="hidden" name="id" value="{$cardNum.card_id}" />
      <input type="hidden" name="old_cardname" value="{$cardNum.card_name}" />
    </td>
  </tr>
</table>
</form>
</div>
{insert_scripts files="../js/jquery.min.js,../js/utils.js,validator.js"}
{literal}
<script language="JavaScript">
document.forms['theForm'].elements['card_name'].focus();

function get_cardNum_con(){
	var elements = document.forms['theForm'].elements;
	var rg_radio = elements['rg_radio'].value;
	if(rg_radio == 1){
		$("#cardNum_con").html('<input type="text" name="card_name" maxlength="60" size = "30" />');
	}else if(rg_radio == 2){
		$("#cardNum_con").html('<input type="text" name="start_card_name" maxlength="60" size = "20" />~<input type="text" name="end_card_name" maxlength="60" size = "20" />');
	}
}
function validate(){
	var elements = document.forms['theForm'].elements;
	var rg_radio = elements['rg_radio'].value;

    validator = new Validator("theForm");
	if(rg_radio == 1){
		var card_name = elements['card_name'].value;
    	validator.isNumber("card_name",  '卡号为空或不是数字');
		if(card_name.length != 9) validator.addErrorMsg("您输入卡号必须是9位数");
	}else if(rg_radio == 2){
		var start_card_name = elements['start_card_name'].value;
		var end_card_name = elements['end_card_name'].value;
		validator.isNumber("start_card_name",   '开始卡号为空或不是数字', 1);
		validator.isNumber("end_card_name",   '末尾卡号为空或不是数字', 1);
		if(start_card_name.length != 9 || end_card_name.length != 9) validator.addErrorMsg("您输入卡号必须是9位数");
		validator.islt("start_card_name", "end_card_name",  '末尾卡号不能小于开始卡号');
	}
    validator.isNumber("card_fee",   '卡值为空或不是数字', 1);
    return validator.passed();
}
onload = function(){
    startCheckOrder();
	get_cardNum_con();
}
</script>
{/literal}
{include file="pagefooter.htm"}